package com.cicigodd.brick.plug.security.Interceptor.base;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 基础的Filter，一般用在权限过滤
 *
 * @author cicigodd
 * @date 2022/09/23 08:42:00
 */
@Slf4j
public abstract class BaseSecurityInterceptor implements HandlerInterceptor {

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {

        // 1.执行真正过滤器业务，如果拦截器执行不成功会抛出异常
        this.filterAction(request, response);

        return true;
    }

    /**
     * 过滤器的具体业务执行逻辑
     *
     * @author cicigodd
     * @date 2020/12/15 22:52
     */
    public abstract void filterAction(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse);

}
